<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<script type="text/javascript">

Ext.onReady(function() {
	
	Ext.QuickTips.init();
	
	Ext.define('Subject', { 
        extend: 'Ext.data.Model', 
        // fields定义字段和数据类型 
        fields: ['id', 'displayName','lesson','description'] 
    });
	
	Ext.define('Presentation', { 
        extend: 'Ext.data.Model', 
        // fields定义字段和数据类型 
        fields: ['id', 'displayName','lesson'] 
    });
	
	Ext.define('HadSubject', { 
        extend: 'Ext.data.Model', 
        // fields定义字段和数据类型 
        fields: ['id', 'displayName','lesson','semester','className'] 
    });
	
	Ext.define('Slow', { 
        extend: 'Ext.data.Model', 
        // fields定义字段和数据类型 
        fields: ['id', 'subjectName','slowtime','slowlesson','addtime','addlesson'] 
    });
	
	var subjectstore=Ext.create('Ext.data.Store', {
        model: 'Subject', 
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/subject_findbystudent',
            //Reader 解码json数据 
            reader: { 
                type: 'json', 
                root: 'subvos', 
            }
        }
    });
	
	var presentationstore=Ext.create('Ext.data.Store', {
        model: 'Presentation', 
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/student_findpresentations',
            //Reader 解码json数据 
            reader: { 
                type: 'json', 
                root: 'subjects', 
            }
        }
    });
	
	var hadsubjectstore=Ext.create('Ext.data.Store', {
        model: 'HadSubject', 
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/subject_findhadbystu',
            //Reader 解码json数据 
            reader: { 
                type: 'json', 
                root: 'hadsubvos', 
            }
        }
    });
	
	var slowstore=Ext.create('Ext.data.Store', {
        model: 'Slow', 
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/slow_findbystu',
            //Reader 解码json数据 
            reader: { 
                type: 'json', 
                root: 'root', 
            }
        }
    });
	
	var subjectinfopanel=Ext.create('Ext.Panel', {
	    id:'subjectinfoinfo-panel',
	    baseCls:'x-plain',
	    renderTo:'subjectinfo',
	    items:[
	    Ext.create('Ext.grid.Panel', {
	    	store: subjectstore,
	    	title: '已报课程:',
	        columns: [ 
	        { 
	            text: '课程名称', width: 180, dataIndex: 'displayName', editor: 'textfield'
	        },{ 
	            text: '总课时', width: 70, dataIndex: 'lesson', editor: 'textfield' 
	        },{ 
	            text: '说明', width: 320, dataIndex: 'description', editor: 'textfield' 
	        }]
	    }),
	    Ext.create('Ext.grid.Panel', {
	    	store: presentationstore,
	    	title: '赠送课程:',
	        columns: [ 
	        { 
	            text: '赠送名称', width: 180, dataIndex: 'displayName', editor: 'textfield'
	        },{ 
	            text: '总课时', width: 70, dataIndex: 'lesson', editor: 'textfield' 
	        }]
	    }),
	    Ext.create('Ext.grid.Panel', {
	    	store: hadsubjectstore,
	    	title: '已上课程:',
	        columns: [ 
	        { 
	            text: '课程名称', width: 180, dataIndex: 'displayName', editor: 'textfield'
	        },{ 
	            text: '课时', width: 70, dataIndex: 'lesson', editor: 'textfield' 
	        },{ 
	            text: '学期', width: 70, dataIndex: 'semester', editor: 'textfield' 
	        },{ 
	            text: '班级', width: 170, dataIndex: 'className', editor: 'textfield' 
	        }]
	    }),
	    Ext.create('Ext.grid.Panel', {
	    	store: slowstore,
	    	title: '缓修课程:',
	        columns: [ 
	        { 
	            text: '课程名称', width: 100, dataIndex: 'subjectName', editor: 'textfield'
	        },{ 
	            text: '缓修时段', width: 170, dataIndex: 'slowtime', editor: 'textfield' 
	        },{ 
	            text: '缓修课时', width: 60, dataIndex: 'slowlesson', editor: 'textfield' 
	        },{ 
	            text: '补修时段', width: 170, dataIndex: 'addtime', editor: 'textfield' 
	        },{ 
	            text: '补修课时', width: 60, dataIndex: 'addlesson', editor: 'textfield' 
	        }]
	    })
	    ],
	    listeners:{
        	'render':function(){
        		subjectstore.load({
        			params:{
        				studentid:Ext.getDom('studentid').value
        			}
        		});
        		presentationstore.load({
        			params:{
        				studentid:Ext.getDom('studentid').value
        			}
        		});
        		hadsubjectstore.load({
        			params:{
        				studentid:Ext.getDom('studentid').value
        			}
        		});
        		slowstore.load({
        			params:{
        				studentid:Ext.getDom('studentid').value
        			}
        		});
        	}
        }
	});
});
</script>
</head>
<body>
<input type="hidden" id="studentid" value="<s:property value='id'/>"/>
	<div id="subjectinfo"></div>
</body>
</html>